#ifndef FileDragUploadResource_h
#define FileDragUploadResource_h

#include <string>

#include <boost/filesystem/path.hpp>

#include <Wt/WEvent>
#include <Wt/WResource>
#include <Wt/Http/Request>
#include <Wt/Http/Response>


class FileDragUploadResource : public Wt::WResource
{
  //FileDragUploadResource is designed to provide a URL to post a file to from
  //  the client side inorder to open the file.  It is not prticularly well
  //  tested as of yet, but seems to work; will not work on older IE..
  //Uploaded file are kept on disk until this object is destructed - which
  //  could be a source of optimization

public:
  FileDragUploadResource( Wt::WObject *parent  );
  virtual ~FileDragUploadResource();
  Wt::Signal<std::string,std::string > *fileDrop(); //<display_name,spool_name>

  void addDragNDropToWidget( Wt::WWebWidget *widget );

protected:
  //XXX - It's assuming handleRequest(...) is only called once all the data
  //      is uploaded.  See implementation for other possible issues.
  virtual void handleRequest( const Wt::Http::Request& request,
                              Wt::Http::Response& response );

private:
  std::vector<boost::filesystem::path> m_spooledFiles;
  Wt::Signal< std::string, std::string >  *m_fileDrop;  //<display_name,spool_name>
};//class FileDragUploadResource ...


#endif  //FileDragUploadResource_h

